#include<sys/epoll.h>
#include<unistd.h>
#include<iostream>

class Epoll
{
public:
    static int CreateEpoll()
    {
        int epfd = epoll_create(256);
        if(epfd > 0) return epfd;
        exit(5);
    }
    static bool CtlEpoll(int epfd, int op, int sock, uint32_t events)
    {
        struct epoll_event ev;
        ev.events = events;
        ev.data.fd = sock;
        int n = epoll_ctl(epfd, op, sock, &ev);
        return n == 0;
    }
    static int WaitEpoll(int epfd, struct epoll_event* revs, int revsNum, int timeout)
    {
        return epoll_wait(epfd, revs, revsNum, timeout);
    }
};